/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import logica.Venda;
import org.hibernate.Session;
import org.hibernate.Transaction;
import util.HibernateUtil;

/**
 *
 * @author AlisonPC
 */
public class VendaDAO {

    private Session sessao;
    private Transaction transacao;

    public void salvar(Venda venda) {
        sessao = HibernateUtil.getSessionFactory().openSession();
        transacao = sessao.beginTransaction();
        sessao.save(venda);
        transacao.commit();
        sessao.close();
    }

    /**
     *
     * @param Venda
     */
    public void remover(Venda venda) {
        sessao = HibernateUtil.getSessionFactory().openSession();
        transacao = sessao.beginTransaction();
        sessao.delete(venda);
        transacao.commit();
        sessao.close();
    }
    
    
}
